﻿<!DOCTYPE html>
<html>
<head>
    <script src="../../js/header.js"></script>
    <script src="../../lib/date/wdatepicker.js"></script>
</head>
<body>
    <div class="data-wrap case" id="container">
        <div class="data-tool clearfix">
            <div class="pull-left form-inline ">
                <a class="btn btn-default" data-modal="/view/order/orderedit.html?type=4" data-title="新增" data-width="450" data-height="266"><span class="glyphicon glyphicon-plus"></span> 新增</a>
            </div>
            <div class="pull-right">
                <form class="form-inline" id="formSearch">
                    <div class="input-group">
                        <label class="input-group-addon m5_l">订单号：</label>
                        <input class="form-control" name="orderNo" type="text" />
                    </div>

                    <div class="input-group">
                        <label class="input-group-addon m5_l">下单日期：</label>
                        <input id="d421" class="Wdate wd125" name="orderDate" type="text" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" />
                        --<input id="d422" class="Wdate wd125 m5_l" name="endOrderDate" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'d421\')}'})" />
                    </div>

                    <div class="input-group">
                        <label class="input-group-addon m5_l">付款日期：</label>
                        <input id="d423" class="Wdate wd125" name="payDate" type="text" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" />
                        --<input id="d4312" class="Wdate wd125 m5_l" name="endpayDate" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'d423\')}'})" />
                    </div>

                    <div class="input-group">
                        <label class="input-group-addon m5_l">付款审核人：</label>
                        <input class="form-control" name="payUserName" type="text" />
                    </div>
                    <button type="button" class="btn btn-default m5_l" id="btnSearch"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                </form>
            </div>
        </div>
        <div class="paging">
        </div>

    </div>
    <script type="text/x-dot-template" id="templatePager">
        <div class="data-head table-responsive">
            <table class="table">
                <thead>
                    <tr>
                        <th>订单号</th>
                        <th>下单日期</th>
                        <th>押金金额</th>
                        <th>押金交付日期</th>
                        <th>押金审核人</th>
                        <th>收货日期</th>
                        <th>付款日期</th>
                        <th>付款金额</th>
                        <th>付款审核人</th>
                        <th width="430">操作</th>
                    </tr>
                </thead>
            </table>
        </div>

        <div class="data-body data-scroll">
            <div class="data-div-view">
                <table class="table table-hover">
                    <tbody>
                        {{~it.result :item:index}}
                        <tr>
                            <td>
                                <a style="color:blue;" href="/view/order/orderdetail.html?orderNo={{= item.orderNo}}&payUID={{=item.payUID}}&depositUID={{=item.depositUID}}">{{= item.orderNo }}</a>
                            </td>
                            <td>{{= FlashPay.Util.GetDateByTime(item.orderDate) }}</td>
                            <td>{{= item.depositAmount }}</td>
                            <td>{{= FlashPay.Util.GetDateByTime(item.depositDate) }}</td>
                            <td>{{= item.depositUID==0?"<span class=\"red bold\">未审核</span>":item.userData[item.depositUID].userName }}</td>
                            <td>{{= FlashPay.Util.GetDateByTime(item.receiptDate) }}</td>
                            <td>{{= FlashPay.Util.GetDateByTime(item.payDate) }}</td>
                            <td>{{= item.payAmount }}</td>
                            <td>{{= item.payUID==0?"<span class=\"red bold\">未审核</span>":item.userData[item.payUID].userName }}</td>
                            <td width="430">
                                <a class="btn btn-info" href="/view/order/orderdetail.html?orderNo={{= item.orderNo}}&payUID={{=item.payUID}}&depositUID={{=item.depositUID}}">查询明细</a>

                                {{? item.depositUID==0 }}
                                <a class="btn btn-warning m5_l"
                                   data-confirm='"{{= item.orderNo }}" <br>确定要执行<span class="orange">押金审核</span>操作吗？'
                                   data-href="/Order/PassDeposit?orderNo={{= item.orderNo}}">押金审核</a>
                                {{? }}

                                {{? item.depositUID!=0 && item.payUID==0 }}
                                <button type="button" class="btn btn-default m5_l" data-modal="/view/order/orderedit.html?orderNo={{= item.orderNo}}&type=3" 
                                        data-title="编辑收货日期" data-width="452" data-height="147">
                                    <span class="glyphicon glyphicon-edit"></span> 编辑收货日期
                                </button>
                                <button type="button" class="btn btn-default m5_l" data-modal="/view/order/orderedit.html?orderNo={{= item.orderNo}}&type=2" 
                                        data-title="编辑付款日期" data-width="452" data-height="147">
                                    <span class="glyphicon glyphicon-edit"></span> 编辑付款日期
                                </button>
                                <a class="btn btn-success m5_l"
                                   data-confirm='"{{= item.orderNo }}" <br>确定要执行<span class="green">付款审核</span>操作吗？'
                                   data-href="/Order/PassPay?orderNo={{= item.orderNo}}">付款审核</a>
                                {{? }}

                                {{? item.depositUID==0 }}
                                <button type="button" class="btn btn-default m5_l" data-modal="/view/order/orderedit.html?orderNo={{= item.orderNo}}&type=0" data-title="编辑 - {{= item.orderNo}}" data-width="452" data-height="266">
                                    <span class="glyphicon glyphicon-edit"></span> 编辑
                                </button>
                                <a class="btn btn-danger m5_l"
                                   data-confirm='"{{= item.orderNo }}" <br>确定要<span class="red">删除</span>该订单吗？'
                                   data-href="/Order/Delete?orderNo={{= item.orderNo}}"><span class="glyphicon glyphicon-trash"></span> 刪除</a>
                                {{? }}
                            </td>
                        </tr>
                        {{~}}
                    </tbody>
                </table>
            </div>
        </div>
        <!-- 必要的分页参数设置 -->
        <input type="hidden" id="TotalCount" value="{{=it.totalCount}}" />
    </script>

    <script type="text/javascript">
        $(function () {
            doSearch();
            //搜索
            $("#btnSearch").click(function () {
                doSearch();
            });
            $("body").keydown(function (event) {
                if (event.keyCode == "13") {
                    doSearch();
                }
            });
        });
        function doSearch() {
            FlashPay.UI.Pager(".paging", { templateId: "templatePager", ajax: { url: '/Order/Get', Method: 'Post' } });
        }
        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }
    </script>
</body>
</html>